<?php
	$callback = $_GET["jsoncallback"];
	header("Content-type: text/html; charset=utf-8"); 
	// 主机地址
	$ip = getenv('HTTP_BAE_ENV_ADDR_SQL_IP');
	// 数据库对外开放的接口
	$port = getenv('HTTP_BAE_ENV_ADDR_SQL_PORT');
	// 当前用户在BAE上的MYSQL用户名
	$username = getenv('HTTP_BAE_ENV_AK');
	// 密码
	$password = getenv('HTTP_BAE_ENV_SK');
	
	$con = mysql_connect($ip.":".$port,$username,$password);
	mysql_query("SET NAMES UTF8");

	if (!$con)
	  {
	  die('Could not connect: ' . mysql_error());
	  }

	mysql_select_db("ZeXQnJerISomEZfhrZEe", $con);

	$result = mysql_query("SELECT * FROM lyrics_rank order by hot");

	$songList = "[";

	while($row = mysql_fetch_array($result))
	{
		$songList .= '{"song":"' . $row['song'] . '","song_id":' . $row['songid'] . ',"singer":"' . $row['singer'] . '","hot":' . $row['hot'] .  '},';
	}
	$songList = substr($songList, 0 , strlen($songList) - 1);
	$songList .= "]";
	echo $callback . '(' . $songList . ')';
	mysql_close($con);
?>